package org.cancer.poseidonroute;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;


@EnableZuulProxy
@EnableDiscoveryClient
@SpringBootApplication
@EnableHystrix
public class RouteServerApplication {
	private static int retry = 15;

	public static void main(String[] args) {
		run(args);
	}
	
	private static void run(String[] args){
		System.out.println(retry);
		try {
			if(retry>0) {
				retry--;
				SpringApplication.run(RouteServerApplication.class, args);
			}
		}
		catch(Exception e) {
			try {
				Thread.sleep(30*1000);
			} catch (InterruptedException e1) {
				// TODO Auto-generated catch block
				//e1.printStackTrace();
			}
			run(args);
		}
	}
}
